package cn.edu.scau.cmi.chenjiale.factory.first;

import cn.edu.scau.cmi.chenjiale.factory.type.BodyInjure;
import cn.edu.scau.cmi.chenjiale.factory.type.CarDestroy;
import cn.edu.scau.cmi.chenjiale.factory.type.Insurance;
import cn.edu.scau.cmi.chenjiale.factory.type.InsuranceType;
import cn.edu.scau.cmi.chenjiale.factory.type.MultiAccident;
import cn.edu.scau.cmi.chenjiale.factory.type.PersonInjure;

/**
 * 创建保险实例的工厂
 * 
 * 
 * @author chen
 *
 */
public class InsuranceFactory {

	public static Insurance getInsurance(String type) {
		Insurance insurance = null;
		if (InsuranceType.BODY_INJURE.equals(type)) {
			insurance = new BodyInjure();
		}
		if (InsuranceType.CAR_DESTROY.equals(type)) {
			insurance = new CarDestroy();
		}
		if (InsuranceType.PERSON_INJURE.equals(type)) {
			insurance = new PersonInjure();
		}
		if (InsuranceType.MULTI_ACCIDENT.equals(type)) {
			insurance = new MultiAccident();
		}
		return insurance;
	}
}
